<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <h:form id="statusprojeto" styleClass="edit">

        <rich:panel>
            <f:facet name="header">#{statusprojetoHome.managed ? 'Edit' : 'Add'} Statusprojeto</f:facet>



            <s:decorate id="nomeField" template="layout/edit.xhtml">
                <ui:define name="label">Nome</ui:define>
                <h:inputTextarea id="nome"
                               cols="80"
                               rows="3"
                              value="#{statusprojetoHome.instance.nome}"/>
            </s:decorate>


            <div style="clear:both">
                <span class="required">*</span>
                required fields
            </div>

        </rich:panel>

        <div class="actionButtons">

            <h:commandButton id="save"
                          value="Save"
                         action="#{statusprojetoHome.persist}"
                       disabled="#{!statusprojetoHome.wired}"
                       rendered="#{!statusprojetoHome.managed}"/>

            <h:commandButton id="update"
                          value="Save"
                         action="#{statusprojetoHome.update}"
                       rendered="#{statusprojetoHome.managed}"/>

            <h:commandButton id="delete"
                          value="Delete"
                         action="#{statusprojetoHome.remove}"
                      immediate="true"
                       rendered="#{statusprojetoHome.managed}"/>

            <s:button id="cancelEdit"
                   value="Cancel"
             propagation="end"
                    view="/Statusprojeto.xhtml"
                rendered="#{statusprojetoHome.managed}"/>

            <s:button id="cancelAdd"
                   value="Cancel"
             propagation="end"
                    view="/#{empty statusprojetoFrom ? 'StatusprojetoList' : statusprojetoFrom}.xhtml"
                rendered="#{!statusprojetoHome.managed}"/>

        </div>
    </h:form>

<rich:tabPanel switchType="ajax">

    <rich:tab label="Projetos">
        <h:form styleClass="association" id="projetosChildren">

            <h:outputText value="There are no projetos associated with this statusprojeto."
                       rendered="#{empty statusprojetoHome.projetos}"/>

            <rich:dataTable value="#{statusprojetoHome.projetos}"
                           var="_projeto"
                      rendered="#{not empty statusprojetoHome.projetos}"
                    rowClasses="rvgRowOne,rvgRowTwo"
                            id="projetosTable">
                <rich:column sortBy="#{_projeto.id}">
                    <f:facet name="header">Id</f:facet>
                    <h:outputText value="#{_projeto.id}"/>
                </rich:column>
                <rich:column sortBy="#{_projeto.cliente}">
                    <f:facet name="header">Cliente</f:facet>
                    <h:outputText value="#{_projeto.cliente}"/>
                </rich:column>
                <rich:column sortBy="#{_projeto.custoprevisto}">
                    <f:facet name="header">Custoprevisto</f:facet>
                    <h:outputText value="#{_projeto.custoprevisto}"/>
                </rich:column>
                <rich:column sortBy="#{_projeto.datacriacao}">
                    <f:facet name="header">Datacriacao</f:facet>
                    <h:outputText value="#{_projeto.datacriacao}">
                        <s:convertDateTime type="both" dateStyle="short"/>
                    </h:outputText>
                </rich:column>
                <rich:column sortBy="#{_projeto.fim}">
                    <f:facet name="header">Fim</f:facet>
                    <h:outputText value="#{_projeto.fim}">
                        <s:convertDateTime type="both" dateStyle="short"/>
                    </h:outputText>
                </rich:column>
                <rich:column sortBy="#{_projeto.fimprevisto}">
                    <f:facet name="header">Fimprevisto</f:facet>
                    <h:outputText value="#{_projeto.fimprevisto}">
                        <s:convertDateTime type="both" dateStyle="short"/>
                    </h:outputText>
                </rich:column>
                <rich:column sortBy="#{_projeto.inicio}">
                    <f:facet name="header">Inicio</f:facet>
                    <h:outputText value="#{_projeto.inicio}">
                        <s:convertDateTime type="both" dateStyle="short"/>
                    </h:outputText>
                </rich:column>
                <rich:column sortBy="#{_projeto.justificativa}">
                    <f:facet name="header">Justificativa</f:facet>
                    <h:outputText value="#{_projeto.justificativa}"/>
                </rich:column>
                <rich:column sortBy="#{_projeto.necessidades}">
                    <f:facet name="header">Necessidades</f:facet>
                    <h:outputText value="#{_projeto.necessidades}"/>
                </rich:column>
                <rich:column sortBy="#{_projeto.nome}">
                    <f:facet name="header">Nome</f:facet>
                    <h:outputText value="#{_projeto.nome}"/>
                </rich:column>
                <rich:column sortBy="#{_projeto.orcamento}">
                    <f:facet name="header">Orcamento</f:facet>
                    <h:outputText value="#{_projeto.orcamento}"/>
                </rich:column>
                <rich:column sortBy="#{_projeto.premissas}">
                    <f:facet name="header">Premissas</f:facet>
                    <h:outputText value="#{_projeto.premissas}"/>
                </rich:column>
                <rich:column sortBy="#{_projeto.produto}">
                    <f:facet name="header">Produto</f:facet>
                    <h:outputText value="#{_projeto.produto}"/>
                </rich:column>
                <rich:column sortBy="#{_projeto.responsabilidadesgp}">
                    <f:facet name="header">Responsabilidadesgp</f:facet>
                    <h:outputText value="#{_projeto.responsabilidadesgp}"/>
                </rich:column>
                <rich:column sortBy="#{_projeto.restricoes}">
                    <f:facet name="header">Restricoes</f:facet>
                    <h:outputText value="#{_projeto.restricoes}"/>
                </rich:column>
                <rich:column sortBy="#{_projeto.resumo}">
                    <f:facet name="header">Resumo</f:facet>
                    <h:outputText value="#{_projeto.resumo}"/>
                </rich:column>
            </rich:dataTable>

        </h:form>

        <f:subview rendered="#{statusprojetoHome.managed}" id="projetos">
        <div class="actionButtons">
            <s:button id="addprojeto"
                   value="Add projeto"
                    view="/ProjetoEdit.xhtml"
             propagation="none">
                 <f:param name="statusprojetoId"
                         value="#{statusprojetoHome.instance.id}"/>
                 <f:param name="projetoFrom" value="Statusprojeto"/>
            </s:button>
        </div>
        </f:subview>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
